<template>
  <div class="insuranceFile">
    <div class="chance">
      <div class="select">
         <div class="block">
          <el-date-picker v-model="value1" type="year" placeholder="选择年">
          </el-date-picker>
        </div>
        <div class="block">
          <el-date-picker v-model="value2" type="month" placeholder="选择月">
          </el-date-picker>
        </div>
      </div>
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        class="query-form"
      >
        <el-form-item>
          <el-input
            v-model="queryParams.employeeTel"
            placeholder="支持姓名、工号、手机号搜索"
            clearable
            size="small"
            @keyup.enter.native="searchMethod"
          >
           <i slot="suffix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="mini">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="context">
      <div class="table">
        <el-table :data="tableData" style="width: 100%">
          <el-table-column type="index" label="序号"> </el-table-column>
          <el-table-column prop="id" sortable label="工号"> </el-table-column>
          <el-table-column prop="name" sortable label="中文姓名">
          </el-table-column>
          <el-table-column prop="amount1" label="所属组织"> </el-table-column>
          <el-table-column prop="amount2" label="在职状态"> </el-table-column>
          <el-table-column prop="amount3" sortable label="缴纳基数平均标准">
          </el-table-column>
          <el-table-column prop="amount4" sortable label="个人缴纳指数">
          </el-table-column>
          <el-table-column prop="amount5" sortable label="单位缴费">
          </el-table-column>
          <el-table-column prop="amount6" sortable label="个人缴费">
          </el-table-column>
          <el-table-column prop="amount7" label="方案名称"> </el-table-column>
          <el-table-column prop="amount8" label="目前状态"> </el-table-column>
          <el-table-column label="操作" prop="createTime" align="center">
            <template slot-scope="scope">
              <el-button
                @click="transfer(scope.row)"
                type="text"
                size="small"
                >移交</el-button
              >
              <el-button type="text" size="small" @click="edit(scope.row)">修改</el-button>
            </template>
          </el-table-column>
          <el-table-column align="center" width="50">
            <template slot="header">
              <el-popover placement="bottom-start" width="100" trigger="click">
                <el-checkbox-group v-model="checkedTableColumns">
                  <div style="display: flex; flex-direction: column">
                    <el-checkbox label="选项">选项</el-checkbox>
                  </div>
                </el-checkbox-group>
                <i
                  class="el-icon-s-tools"
                  @click="clickReset"
                  style="font-size: 25px"
                  slot="reference"
                ></i>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
       <edit v-if="editDialog" :editDialog="editDialog" @close="closeEdit"></edit>
        <transfer v-if="transferDialog" :transferDialog="transferDialog" @close="closeTransfer"></transfer>
      </div>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="100"
        background=""
        layout="total, sizes, prev, pager, next, jumper"
        :total="10"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import edit from "./edit.vue";
import transfer from "./transfer.vue";
export default {
  name: "insuranceFile",
  components: { edit,transfer },
  data() {
    return {
      activeName: "first",
      transferDialog:false,
      editDialog:false,
      value1:'',
      value2:'',
      tableData: [
        {
          id: "P0001",
          name: "唐静",
          amount1: "新闻与网络传播系",
          amount2: "正式",
          amount3: 46,
          amount4: 2,
          amount5: 46,
          amount6: 46,
          amount7: "教职工社保方案",
          amount8: "通过",
        },
        {
          id: "P0032",
          name: "雷琪",
          amount1: "新闻与网络传播系",
          amount2: "正式",
          amount3: 46,
          amount4: 2,
          amount5: 46,
          amount6: 46,
          amount7: "教职工社保方案",
          amount8: "驳回",
        },
        {
          id: "P0004",
          name: "曹峰",
          amount1: "新闻与网络传播系",
          amount2: "正式",
          amount3: 46,
          amount4: 2,
          amount5: 46,
          amount6: 46,
          amount7: "教职工社保方案",
          amount8: "待审核",
        },
      ],
      queryParams: {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeJoinStatus: null,
        employeeFormalStatus: null,
        employeeLeaveStatus: null,
        employeeRetiredStatus: null,
        current: 1, //当前页码
        size: 10, //每页显示数量
      },
    };
  },
  methods: {
    handleClick(tab, event) {
      let name = tab.name;
      switch (name) {
        case "holdPost":
          this.queryParams.employeeStatus = "2";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            {
              prop: "employeeStatus",
              label: "转正状态",
              show: true,
              disable: false,
            },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeTel",
              label: "手机号",
              show: true,
              disable: false,
            },
          ];
          break;
        case "leave":
          this.queryParams.employeeStatus = "3";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeJoinTime",
              label: "入职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeLeaveTime",
              label: "离职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeLeaveType",
              label: "离职类型",
              show: true,
              disable: false,
            },
          ];
          break;
        case "retired":
          this.queryParams.employeeStatus = "4";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeJoinTime",
              label: "入职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeePlanLeaveTime",
              label: "计退休日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeRetiredTime",
              label: "办理日期",
              show: true,
              disable: false,
            },
          ];
          break;
        default:
          this.queryParams.employeeStatus = "2";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            {
              prop: "employeeStatus",
              label: "转正状态",
              show: true,
              disable: false,
            },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeTel",
              label: "手机号",
              show: true,
              disable: false,
            },
          ];
          break;
      }
    },
    clickReset() {
      this.reset = !this.reset;
    },
    resetQuery() {
      this.queryParams = {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeStatus: "2",
        size: 10,
        current: 1,
      };
      this.getPageList();
    },
    // 翻页
    handleCurrentChange(val) {
      this.queryParams.current = val;
      this.getPageList();
    },
    handleUpdate() {
      this.dialogFormVisible = true;
    },
    // 移交弹窗
    transfer(){
      this.transferDialog=true;
    },
    closeTransfer(params){
      this.transferDialog=params
    },
    // 修改弹窗
    edit(){
      this.editDialog=true;
    },
    closeEdit(params){
      this.editDialog=params;
    },
  },
};
</script>

<style scoped>
.el-table {
  margin-top: 20px;
}
.el-tabs {
  margin: 0 10px;
}
.el-tabs__item {
  font-size: 16px;
  font-weight: bold;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.chance {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.context {
  padding-left: 20px;
}
.select {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.el-link {
  margin: 0 5px;
}
.select .el-dropdown-link {
  color: black;
  border: 1px solid #ccc;
  padding: 10px;
  margin-right: 20px;
  border-radius: 5px;
}
.el-date-editor {
  width: 120px;
  margin-right: 20px;
}
.el-pagination {
  margin-top: 20px;
  float: right;
}
</style>